//
//  MenuFirstTableViewCell.m
//  Products_B
//
//  Created by lanou on 16/5/30.
//  Copyright © 2016年 朋学友. All rights reserved.
//

#import "MenuFirstTableViewCell.h"

@implementation MenuFirstTableViewCell

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.picImageView = [[UIImageView alloc]initWithFrame:CGRectMake(10, 10, 100, 100)];
        self.playButton = [UIButton buttonWithType:(UIButtonTypeSystem)];
        self.playButton.frame = CGRectMake(50, 50, 30, 30);
        [self.playButton setBackgroundImage:[UIImage imageNamed:@"menubofang"] forState:(UIControlStateNormal)];
//        [self.picImageView addSubview:_playButton];
        self.titleLabel = [[UILabel alloc]initWithFrame:CGRectMake(120, 10, kWidth - 130, 20)];
        self.titleLabel.font = [UIFont systemFontOfSize:14];
        self.descLabel = [[UILabel alloc]initWithFrame:CGRectMake(120, 40, kWidth - 130, 10)];
        self.descLabel.font = [UIFont systemFontOfSize:12];
        self.descLabel.textColor = [UIColor grayColor];
        self.siImageView1 = [[UIImageView alloc]initWithFrame:CGRectMake(120, 60, 10, 10)];
        self.siLabel1 = [[UILabel alloc]initWithFrame:CGRectMake(130, 60, 40, 10)];
        self.siLabel1.text = @"难易度:";
        self.siLabel1.textColor = [UIColor grayColor];
        self.siLabel1.font = [UIFont systemFontOfSize:12];
        self.hertLabel = [[UILabel alloc]initWithFrame:CGRectMake(170, 60, 40, 10)];
        self.hertLabel.textColor = [UIColor grayColor];
        self.hertLabel.font = [UIFont systemFontOfSize:12];
        
        self.siImageView2 = [[UIImageView alloc]initWithFrame:CGRectMake(kWidth - 70, 60, 10, 10)];
        self.siLabel2 = [[UILabel alloc]initWithFrame:CGRectMake(kWidth - 60, 60, 30, 10)];
        self.siLabel2.text = @"口味:";
        self.siLabel2.textColor = [UIColor grayColor];
        self.siLabel2.font = [UIFont systemFontOfSize:12];
        self.tasteLabel = [[UILabel alloc]initWithFrame:CGRectMake(kWidth - 30, 60, 20, 10)];
        self.tasteLabel.textColor = [UIColor grayColor];
        self.tasteLabel.font = [UIFont systemFontOfSize:12];
        
        self.siImageView3 = [[UIImageView alloc]initWithFrame:CGRectMake(120, 90, 10, 10)];
        self.siLabel3 = [[UILabel alloc]initWithFrame:CGRectMake(130, 90, 60, 10)];
        self.siLabel3.text = @"烹饪时间:";
        self.siLabel3.textColor = [UIColor grayColor];
        self.siLabel3.font = [UIFont systemFontOfSize:12];
        self.timeLabel = [[UILabel alloc]initWithFrame:CGRectMake(190, 90, 80, 10)];
        self.timeLabel.textColor = [UIColor grayColor];
        self.timeLabel.font = [UIFont systemFontOfSize:12];
        
        [self.contentView addSubview:_picImageView];
        [self.contentView addSubview:_titleLabel];
        [self.contentView addSubview:_descLabel];
        [self.contentView addSubview:_siImageView1];
        [self.contentView addSubview:_siImageView2];
        [self.contentView addSubview:_siImageView3];
        [self.contentView addSubview:_siLabel1];
        [self.contentView addSubview:_siLabel2];
        [self.contentView addSubview:_siLabel3];
        [self.contentView addSubview:_hertLabel];
        [self.contentView addSubview:_tasteLabel];
        [self.contentView addSubview:_timeLabel];
        [self.contentView addSubview:_playButton];
    }
    return self;
}
- (void)cellConfigureWithModel:(MenuFirstModel *)model{
    [self.picImageView sd_setImageWithURL:[NSURL URLWithString:model.image] placeholderImage:nil completed:nil];
    self.titleLabel.text = model.title;
    self.descLabel.text = model.descriptiont;
    self.hertLabel.text = [NSString stringWithFormat:@"%@    |",model.hard_level];
    self.tasteLabel.text = model.taste;
    self.timeLabel.text = model.cooking_time;
}
@end
